<template>
  <div class="deploy-config-dialog">
      <appdialog
      ref="dialog"
			:visible="false" 
			title="设置部署配置"
			@confirm="confirmAdd"
			@cancle="cancleAdd"
			width="70%">
			
				<div v-loading="loading">
					<deployConfig
			  	ref="deployConfig"
			  	:deployTypeProp="deployType"
					:templateTypeProp="templateType"
			  	></deployConfig>
				</div>
				
			</appdialog>
      
  </div>
</template>




<script>
import appdialog from "@/view/components/dialog/dialog";
import deployConfig from "@/view/pages/yingyong/deploy/deployConfig" ;

  export default {
    components:{
      appdialog,
      deployConfig
    },
    data(){
      return{
      	loading :true ,
      	//activeTab : 1 ,
      	deployType : 1 ,
      	templateType : 1 ,
//      formData : {
//        
//      },
      }
    },
    mounted() {
      
    },
    methods:{
      confirmAdd(){
				this.$refs.deployConfig.validateForm({
					onSuccess : (data)=>{
						this.$emit("close","deployConfigDialog",data , true)
//						this.formData = data ;
//						this.postDeploySubmit()
					},
					onError : (index)=>{
						setTimeout(()=>{
							this.open();
						},200)
					}
				})
      },
      cancleAdd(){
				// const data = this.$refs.deployConfig.getFormData();
				// this.$emit("close","deployConfigDialog",data , false)
				// this.$refs.deployConfig.$destroy();
      },
      initData(data,formData,isHistory,isBpDeploy){
      	this.loading = true ;
      	setTimeout(()=>{
      		this.$refs.deployConfig.initConfigs(formData||data,isHistory,isBpDeploy);
      		//setTimeout(()=>{
      			this.$refs.deployConfig.initTypes(data,["7"],true);
      			this.loading = false;
      		//},300)
      	},100)
      },
      open(){
        this.$refs.dialog.open();
        return this ;
      },
    }
  }
</script>


<style lang="scss">
	@import "../../../../styles/variables.scss";
	
	.deploy-config-dialog { 
		.el-table {
				.el-form-item__error {
					position:absolute !important;
				}
				.el-form,.el-form-item {
					margin: 0 !important; 
				}
		}
	}
	
</style>